/**
 * @author Yuliy Khorolinskyy
 *
 * Reaktionsspiel control
 *
 * 23.01.2012
 */
package control;

import gui.DialogCollection;
import gui.menu.HighscoreMenu;

import data.HighscoreEntry.DIFFICULTY;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author Yuliy
 *
 */
public class HighscoreMenuManager implements ActionListener, Manager{

	Control c;
	
	
	public HighscoreMenuManager(Control c) {
		this.c = c;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		
		String command = e.getActionCommand();
		
		if(command.equals("EASY")){
			c.gui.highscoremenu.selectDifficulty(DIFFICULTY.EASY);
		}else if(command.equals("MEDIUM")){
			c.gui.highscoremenu.selectDifficulty(DIFFICULTY.MEDIUM);
		}else if(command.equals("HARD")){
			c.gui.highscoremenu.selectDifficulty(DIFFICULTY.HARD);
		}else if(command.equals("DELETE HIGHSCORES")){
			c.getHighscores().deleteHighscores(DialogCollection.showDeleteHighscoresDialog(c.gui.highscoremenu.getDifficulty()));
			c.gui.highscoremenu.selectDifficulty(c.gui.highscoremenu.getDifficulty());
		}else if(command.equals("BACK")){
			IOManager.saveHighscores(c.highscores);
			c.gui.showMenu("MainMenu");
		}
		
	}
}
